<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>第四届  IT农场报名表</title>

<!-- Bootstrap -->
<link href="./css/bootstrap.min.css" rel="stylesheet">
<link href="./css/bootstrap-responsive.min.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<div class="container">
  <div class="row text-center">
    <div class="col-md-6 col-md-offset-3">
        
        
        
        
  <form class="form-horizontal">
    <fieldset>
      <div id="legend" class="">
        <legend class="">表单名</legend>
      </div>
    <div class="control-group">

          <!-- Select Basic -->
          <label class="control-label">Select - Basic</label>
          <div class="controls">
            <select class="input-xlarge">
      <option>1</option>
      <option>2</option>
      <option>3</option></select>
          </div>

        </div><div class="control-group">
          <label class="control-label">Checkboxes</label>
          <div class="controls">

            <!-- Multiple Checkboxes -->
            <label class="checkbox">
              <input type="checkbox" value="Option one">
              Option one
            </label>
            <label class="checkbox">
              <input type="checkbox" value="Option two">
              Option two
            </label>
          </div>

        </div><div class="control-group">
          <label class="control-label">Radio buttons</label>
          <div class="controls">

            <!-- Multiple Radios -->
            <label class="radio">
              <input type="radio" value="Option one" name="group" checked="checked">
              Option one
            </label>
            <label class="radio">
              <input type="radio" value="Option two" name="group">
              Option two
            </label>
          </div>

        </div><div class="control-group">

          <!-- Text input-->
          <label class="control-label" for="input01">Text input</label>
          <div class="controls">
            <input type="text" placeholder="placeholder" class="input-xlarge">
            <p class="help-block">Supporting help text</p>
          </div>
        </div>

    <div class="control-group">

          <!-- Search input-->
          <label class="control-label">Search input</label>
          <div class="controls">
            <input type="text" placeholder="placeholder" class="input-xlarge search-query">
            <p class="help-block">Supporting help text</p>
          </div>

        </div>

    <div class="control-group">

          <!-- Select Basic -->
          <label class="control-label">Select - Basic</label>
          <div class="controls">
            <select class="input-xlarge">
              <option>Enter</option>
              <option>Your</option>
              <option>Options</option>
              <option>Here!</option>
            </select>
          </div>

        </div>

    <div class="control-group">
          <label class="control-label">Button</label>

          <!-- Button -->
          <div class="controls">
            <button class="btn btn-success">Button</button>
          </div>
        </div>

    <div class="control-group">
          <label class="control-label">Button</label>

          <!-- Button -->
          <div class="controls">
            <button class="btn btn-success">Button</button>
          </div>
        </div>

    </fieldset>
  </form>

        
        
        
        
        
        
        
         </div>
        </div>
      </div>

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> 
<script src="./js/jquery-1.11.2.min.js"></script> 

<!-- Include all compiled plugins (below), or include individual files as needed --> 
<script src="./js/bootstrap.js"></script>

<script src='./js/baiduTemplate.js'></script>
<script src="./js/module/user.js"></script>
<script type="text/javascript">
function ajaxSubmit(frm, fn) {
    var dataPara = getFormJson(frm);
    //console.log(frm);
    $.ajax({
        url: frm.action,
        type: frm.method,
        data: dataPara,
        success: fn
    });
}


function getFormJson(frm) {
    var o = {};
    var a = $(frm).serializeArray();
    $.each(a, function () {
        if (o[this.name] !== undefined) {
            if (!o[this.name].push) {
                o[this.name] = [o[this.name]];
            }
            o[this.name].push(this.value || '');
        } else {
            o[this.name] = this.value || '';
        }
    });

    return o;
}

$(document).ready(function(){
     $("div[name=userlist]").html(auditTemplate());
    $('input:radio[name=user_count]').change( function(){
        
        
        
        var $selectedvalue = $("input:radio[name=user_count]:checked").val();
        
        for(var n=0; n<5;n++){
            if(n<parseInt($selectedvalue)-1)
            $("#user"+n).attr("class","null");
            else{
                $("#user"+n).attr("class","hide");
            }
        }
        
        //alert($selectedvalue);
        
        
        
    })
    
    
    
    $('.form-horizontal').bind('submit', function(event){
    	event.preventDefault();
    	//console.log(event.type);
    	
        ajaxSubmit(this, function(data){
        	
        	
        		
  
        	
        });
        alert("提交成功");
        return false;
    });
    
});


</script>
</body>
</html>